<?php
header('Content-Type:text/html;charset=utf-8');
class MatchController extends Controller{
    public function matchAction(){
        $config=require_once('./app/common/config.php');
        $match = Factory::Once('MatchModel',$config);
        $res=$match->MatchMadol($config);
        $this->assign('res',$res);
        $this->display();
    }

    public function deleteAction(){
    	$config=require_once('./app/common/config.php');
        $match = Factory::Once('MatchModel',$config);
        if($match->delete($config)){
            echo '<script>alert("删除成功");window.location.href="index.php"</script>';
        }
        $this->display();
    }

     public function insertAction(){
        $config = require_once('./app/common/config.php');
        $match =Factory::Once('InformationModel',$config);
        $allTeam = $match->allTeam($config);
        $this->assign('allTeam',$allTeam);
        $this->display();
    }

    public function doinsertAction(){
    	$config=require_once('./app/common/config.php');
        $match = Factory::Once('MatchModel',$config);
        if($match->doinsert($_POST)){
            echo '<script>alert("添加成功");window.location.href="index.php"</script>';
        }
        $this->display();
    }
}
?>
